import axios,{ type AxiosResponse } from 'axios'

declare module 'axios'{
    interface AxiosInstance{
        data:any,
        code:number,
        (cofing:AxiosRequestConfig):Promise<AxiosInstance>
    }
}

let $axios = axios.create({
    baseURL:'http://127.0.0.1:3000',    //服务器地址
    timeout:5000
})

//请求拦截
$axios.interceptors.request.use((res)=>{
    // if(res.url!='/login'){
    //     res.headers.Authentication = localStorage.getItem('token')
    // }
    return res
})

//响应拦截
$axios.interceptors.response.use((res:AxiosResponse<any,any>)=>{
    return res.data;
})
export const  ImgUrl = 'http://127.0.0.1:3000/'
export default $axios;
    